home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Multimedia Plus
/
Multimedia Plus with ClearVue Version 10-94 (Knowledge Media Inc.).ISO
/
clearvue
/
clearvue.&&&
< prev
next >
Wrap
Text File
|
1994-11-06
|
10KB
|
342 lines
'**************************************************************************
'*
'* Clearvue.MST - Clear Vue Runtime Setup Script
'*
'* CUSTOMIZING ClearVue.MST
'*
'* For a simple Setup routine, you just need to assign values to the
'* series of variables following the heading "Setup Variables". This
'* script also provides for the following more-advanced options, which
'* are supported by subroutines located later in this script:
'*
'* Option See Subroutine
'* ------------------------------------------ ---------------------
'* Install more than one .MVB file ModifyIni
'* Install Help title ModifyIni
'* Install custom DLLs ModifyIni
'* Install multiple Program Manager items ModifyProgramManager
'* Display a custom icon with the ProgMan item ModifyProgramManager
'* Install custom fonts RegisterCustomFonts
'* Install Video for Windows runtime files RegisterDrivers
'*
'* Each customization note starts with the heading CUSTOMIZATION.
'*
'**************************************************************************
'' Global variables
GLOBAL TitleShortName$
GLOBAL TitleLongName$
GLOBAL MVBFileName$
GLOBAL PromptForPath%
GLOBAL DefaultPath$
GLOBAL ProgManGroup$
GLOBAL ProgManItem$
'' ****************************************************************
'' ** Setup Variables
'' ****************************************************************
'' Set the following string to a short form of the title name
'' (for example, "Gallery")
TitleShortName$ = "ClearVue"
'' Set the following string to a long form of the title name
'' (for example, "Viewer 2.0 Gallery")
TitleLongName$ = "Clear Vue"
'' Set the following variable to the name of the MVB file, without
'' the filename extension (for example, "GALLERY")
VUEFileName$ = "ClearVue"
'' The following variable determines whether Setup prompts the user
'' to specify a directory in which to install title files. (Files
'' to be installed on the hard disk must be listed in the TITLE.INF
'' file under the [Installed Title Files] section.) Specify one of
'' the following values:
''
'' 0 Install title files in the Windows directory (default setting).
'' This is an appropriate setting if you have a limited number
'' of files to copy (for example, a single custom icon or DLL).
''
'' 1 Display a dialog box to prompt the user for a directory in
'' which to install files
PromptForPath% = 0
'' If you have specified 1 in PromptForPath%, set the following
'' variable to the default path that will be displayed in the dialog
'' box (for example, "C:\GALLERY").
DefaultPath$ = ""
'' Set the following variable to the name of the program manager
'' group you would like to create (for example, "Viewer 2.0 Gallery")
ProgManGroup$ = "ClearVue"
'' Set the following variable to the caption of the program manager
'' item for your title (for example, "Gallery")
ProgManItem$ = "ClearVue"
'***********************************************************************
'** Mainline
'***********************************************************************
GLOBAL CUIDLL$
'' Include files
'$INCLUDE 'setupapi.inc'
'' Custom UI dll
CUIDLL$ = "mscuistf.dll"
'' Dialog ID's
CONST DESTPATH = 1000
CONST APPHELP = 2000
CONST TOOBIG = 3000
CONST BADPATH = 4000
CONST SUCCESS = 700
'' Bitmap ID
CONST LOGO = 1
'' Functions and subroutines
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
DECLARE SUB ModifyProgramManager
DECLARE SUB ShowSuccess
'' The following statement turns size checking off. Set it to scmOnFatal
'' to enable size checking, where Setup will compare the disk file size
'' with the INF file size and report an error if they are not the same.
i% = SetSizeCheckMode(scmOff)
'' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to
'' alter the banner bitmap.
SetTitle "Clear Vue Setup"
SetBitmap CUIDLL$, LOGO
'' Read in the INF file.
ReadInfFile GetSymbolValue("STF_CWDDIR") + "clearvue.INF"
'' Decide where to put title files
IF PromptForPath% = 1 THEN
szTitleDir$ = GetTitleDir(DefaultPath$)
IF szTitleDir$ = "" THEN
GOTO QUIT
ENDIF
ELSE
szTitleDir$ = GetWindowsDir()
ENDIF
'' Copy files
IF CopyFiles(szTitleDir$) = 0 THEN
GOTO QUIT
ENDIF
'' Modify Program Manager
ModifyProgramManager
'' Success dialog
''ShowSuccess
'' Now start the title
RUN "MMDEMO\INSTALL.EXE", NOWAIT
QUIT:
END
'*************************************************************************
'** Purpose:
'** Prompts the user for a path for the title files
'** Arguments:
'** szDefault$ - default path
'** Returns:
'** New valid path name, or "" if the user quit.
'*************************************************************************
FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
SetSymbolValue "String", TitleShortName$
SetSymbolValue "EditTextIn", szDefault$
SetSymbolValue "EditFocus", "ALL"
GETPATH:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
IF sz$ = "CONTINUE" THEN
szTitleDir$ = GetSymbolValue("EditTextOut")
IF IsDirWritable(szTitleDir$) = 0 THEN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
GOTO GETPATH
END IF
UIPop 1
CreateDir szTitleDir$, cmoNone
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATH
ELSE
szTitleDir$ = ""
END IF
GetTitleDir = szTitleDir$
END FUNCTION
'*************************************************************************
'** Purpose:
'** Copies the files in the INF file
'** Arguments:
'** szTitleDir$ - destination directory for the title files
'** Returns
'** 1 if files were copied, 0 otherwise
'*************************************************************************
FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
'' Add for Windows Section files to the copy list
AddSectionFilesToCopyList "Clear Vue Files", MakePath(GetSymbolValue("STF_SRCDIR"),"ClearVue"), GetWindowsDir()
'' Check size
szExtras$ = "Extra"
szCosts$ = "Costs"
szNeededs$ = "Neededs"
FOR i% = 1 TO 26 STEP 1
AddListItem szExtras$, "0"
NEXT i%
'' Get amount of space required
StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
'' Put up a message if there is not enough space
FOR i% = 1 TO 26 STEP 1
IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
CopyFiles = 0
GOTO DONTCOPY
END IF
NEXT i%
'' Copy the files
CopyFilesInCopyList
CopyFiles = 1
DONTCOPY:
END FUNCTION
'*************************************************************************
'** Purpose:
'** Puts up a success dialog
'*************************************************************************
SUB ShowSuccess STATIC
SUCCESS:
SetSymbolValue "String1", TitleShortName$
sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO SUCCESS
END IF
UIPop 1
END SUB
'*************************************************************************
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
'*************************************************************************
'** Purpose:
'** Creates program manager entries for the title
'*************************************************************************
SUB ModifyProgramManager STATIC
'' Create the program manager group
CreateProgmanGroup ProgmanGroup$, "", cmoNone
ShowProgmanGroup ProgmanGroup$, 1, cmoNone
'' Create an entry for the title
CreateProgmanItem ProgmanGroup$, ProgmanItem$, "clearvue.exe ","", cmoOverwrite
'' CUSTOMIZATION:
''
'' To create additional Program Manager items, copy the preceding
'' statement for each additional item, substituting the appropriate
'' name for the VUEFileName$ variable.
''
'' To display a custom icon with the Program Manager item, specify
'' the icon filename with the fourth parameter (this parameter is
'' currently an empty string, ""). The following example specifies
'' an icon with the same filename as the .exe file:
''
'' CreateProgmanItem ProgmanGroup$, ProgmanItem$, "clearvue.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), VUEFileName$ + ".exe"), MakePath(GetSymbolValue("STF_SRCDIR"), VUEFileName$ + ".ICO"), cmoOverwrite
END SUB